#pragma once
#include "..\awt4mfc\awtapplet.h"

class NavPanel : public AWTPanel
{
public:
	AWTTextField* m_text;
	AWTButton* m_button;

	NavPanel()
	{
		AWTGridBagLayout* gbl = new AWTGridBagLayout();
		AWTGridBagConstraints* gbc = new AWTGridBagConstraints();
		setLayout(gbl);

		m_text = new AWTTextField("http://www.codeplex.com/awt4mfc");
		gbc->m_fill = AWTGridBagConstraints::BOTH;
		gbc->m_weightx = 1.0;
		gbl->setConstraints(m_text, gbc);
		add(m_text);

		m_button = new AWTButton("Go");
		gbc->m_weightx = 0.1;
		gbl->setConstraints(m_button, gbc);
		add(m_button);
	}
};

class BrowserApplet :	public AWTApplet, public AWTActionListener
{
public:
	BrowserApplet(CWnd* parent) : AWTApplet(parent){};
	virtual ~BrowserApplet(){};

	virtual void init();
	virtual void start(){};
	virtual void stop(){};
	virtual void destroy(){};

	NavPanel* m_navPanel;
	Browser* m_browser;

	virtual void actionPerformed(AWTActionEvent* e)
	{
		m_browser->setURL(m_navPanel->m_text->getText());
	}

};
